package com.bw.http.utils

import com.bw.base.constants.ApiConst
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

class RetrofitUtils {
    companion object{
        //
        fun getRetrofit():Retrofit{
            val client = OkHttpClient.Builder()
                .addInterceptor(HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY))
                .addInterceptor(AccessIdInterceptor())
                .addInterceptor(TokenInterceptor())
                .build()

            return Retrofit.Builder()
                .client(client)
                .baseUrl(ApiConst.BASE_URL)
                .addConverterFactory(GsonConverterFactory.create())
                .build()
        }
    }
}